package com.example.text01

import android.os.Bundle
import android.view.View
import android.widget.ArrayAdapter
import android.widget.ImageView
import android.widget.Spinner
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.bumptech.glide.Glide

class MainActivity4 : AppCompatActivity(), View.OnClickListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main4)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }

        // var img = findViewById<ImageView>(R.id.img3)


        //Glide.with(this).load("https://www.itcast.cn/2018czgw/images/logo2.png").into(img)

        // 初始化城市下拉菜单
        val citySpinner: Spinner = findViewById<Spinner>(R.id.citySpinner)
        val cities = arrayOf("请选择城市", "北京", "上海", "广州", "深圳", "杭州", "成都")
        // 创建适配器
        val adapter = ArrayAdapter(this, android.R.layout.simple_list_item_multiple_choice, cities)
        adapter.setDropDownViewResource(android.R.layout.simple_list_item_multiple_choice)
        citySpinner.adapter = adapter
    }

    fun starClick(view: View) {
        Toast.makeText(this, "view", Toast.LENGTH_SHORT).show()
    }

    override fun onClick(v: View?) {
        TODO("Not yet implemented")

    }


}